package com.example.userservice.novel.repository;

import com.example.userservice.novel.entity.NovelStructureEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface NovelStructureRepository extends JpaRepository<NovelStructureEntity, Long> {

    // 根据小说名称查找
    List<NovelStructureEntity> findByNovelNameContainingIgnoreCase(String novelName);

    // 根据状态查找
    List<NovelStructureEntity> findByStatus(String status);

    // 查找最近生成的小说
    List<NovelStructureEntity> findTop10ByOrderByCreatedAtDesc();

    // 根据创建时间范围查找
    List<NovelStructureEntity> findByCreatedAtBetween(Date start, Date end);

    // 检查小说名称是否存在
    boolean existsByNovelName(String novelName);
}
